*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* OUTPUT: FIGURE 3, PANEL B

***************************

cd ""

global horizon 6 
global ci = 1.645

************ PREPARE DATASET **********

run "Do files/Clean dataset"

* Hourly wage
gen W = 100*log((lab/H_EMP)/PCPI)

* Dependent variables
foreach v in W {
gen `v'1 = `v'-l.`v'
forvalues i = 2 / $horizon {
local sc = `i'-1
gen `v'`i' = f`sc'.`v'-l.`v'
}
}

* Lags dependent variable
foreach v in W {
forvalues l = 1 / 6 {
gen l`l'`v' = l`l'.`v'1
}
}

************ ANALYSIS AND GRAPH **********

matrix baseline = J($horizon,4,.)

forvalues i= 1/$horizon {
quietly reghdfe  W`i' r2 l1W l2W l3W l4W l1r2 l2r2 l3r2 l4r2 t2 ${f`i'2}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
matrix baseline[`i',1] = results[1,1]
matrix baseline[`i',2] = results[2,1]
matrix baseline[`i',3] = results[1,1] + $ci*results[2,1]
matrix baseline[`i',4] = results[1,1] - $ci*results[2,1]
}
matrix coeff2 = baseline[1...,"c1"]
matrix ci_p2 = baseline[1...,"c3"]
matrix ci_n2 = baseline[1...,"c4"]
capture drop coeff2 ci_p2 ci_n2
svmat coeff2
svmat ci_p2
svmat ci_n2
capture drop horizon
egen horizon = group(year) 
replace horizon = . if coeff21==.

* Create graph
graph set window fontface "Times New Roman"
graph twoway line coeff2 ci_p2 ci_n2 horizon, graphregion(color(white)) ytitle("") xtitle("") yline(0, lcolor(black)) xlabel(, nolabels) legend(off) ///
lpattern(solid shortdash shortdash) lwidth (thick thick thick) lcolor(blue red red) ytitle("% change", height(5)) subtitle("{bf:Panel B.} Hourly wage") ysize(10) xsize(15)
graph copy B, replace
